/*
 * MusicaComponent.java
 *
 * Created on 07/02/2012, 22:52:34
 */
package com.fila;

import com.musica.MusicaS;
import com.utils.pele.ColorUtils;

/**
 *
 * @author rudieri
 */
public class MusicaComponent extends javax.swing.JPanel {

    private MusicaS musica;

    public MusicaComponent() {
        initComponents();
    }

    public MusicaS getMusica() {
        return musica;
    }

    public void setMusica(MusicaS musica) {
        this.musica = musica;
        jLabelTempo.setText(musica.getTempo().toString());
        jLabelNome.setText(musica.getNome());
        jLabelArtista.setText("Por: " + musica.getAlbum().getAutor().getNome());
    }

    public void setSelecionado(boolean sel) {
        if (sel) {
            jLabelArtista.setForeground(ColorUtils.getFrenteTabelaSelecionada());
            jLabelNome.setForeground(ColorUtils.getFrenteTabelaSelecionada());
            jLabelTempo.setForeground(ColorUtils.getFrenteTabelaSelecionada());
            setForeground(ColorUtils.getFrenteTabelaSelecionada());
            setBackground(ColorUtils.getFundoTabelaSelecionada());
        } else {
            jLabelArtista.setForeground(ColorUtils.getFrenteTabelaNaoSelecionada());
            jLabelNome.setForeground(ColorUtils.getFrenteTabelaNaoSelecionada());
            jLabelTempo.setForeground(ColorUtils.getFrenteTabelaNaoSelecionada());
            setForeground(ColorUtils.getFrenteTabelaNaoSelecionada());
            setBackground(ColorUtils.getFundoTabelaNaoSelecionada());
        }

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabelNome = new javax.swing.JLabel();
        jLabelTempo = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabelArtista = new javax.swing.JLabel();

        setBorder(new javax.swing.border.LineBorder(new java.awt.Color(99, 99, 99), 1, true));
        setForeground(javax.swing.UIManager.getDefaults().getColor("Panel.foreground"));
        setPreferredSize(new java.awt.Dimension(120, 50));
        setLayout(new java.awt.BorderLayout());

        jPanel2.setOpaque(false);
        jPanel2.setPreferredSize(new java.awt.Dimension(113, 20));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jLabelNome.setForeground(javax.swing.UIManager.getDefaults().getColor("Panel.foreground"));
        jLabelNome.setText("Musica");
        jPanel2.add(jLabelNome, java.awt.BorderLayout.CENTER);

        jLabelTempo.setForeground(javax.swing.UIManager.getDefaults().getColor("Panel.foreground"));
        jLabelTempo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabelTempo.setText("00:00:00");
        jLabelTempo.setPreferredSize(new java.awt.Dimension(65, 18));
        jPanel2.add(jLabelTempo, java.awt.BorderLayout.EAST);

        add(jPanel2, java.awt.BorderLayout.PAGE_START);

        jPanel1.setOpaque(false);
        jPanel1.setLayout(new java.awt.BorderLayout());

        jLabelArtista.setFont(new java.awt.Font("Ubuntu", 0, 12)); // NOI18N
        jLabelArtista.setForeground(javax.swing.UIManager.getDefaults().getColor("Panel.foreground"));
        jLabelArtista.setText("Artista");
        jLabelArtista.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabelArtista.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jPanel1.add(jLabelArtista, java.awt.BorderLayout.CENTER);

        add(jPanel1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabelArtista;
    private javax.swing.JLabel jLabelNome;
    private javax.swing.JLabel jLabelTempo;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables
}
